Analysis of Hourly Values¶
import plotClassAndFunc as hm
import pandas as pd
from ipywidgets import interact, interactive, fixed, interact_manual, IntSlider
# Standard plotly imports
import chart_studio.plotly as py
import plotly.graph_objs as go
from plotly.offline import iplot, init_notebook_mode
# Using plotly + cufflinks in offline mode
import cufflinks as cf
cf.go_offline(connected=False)
init_notebook_mode(connected=False)
listLat=['\Delta t','DNI', 'T_{amb}', '\dot{m}_{Demand}', 'T_{demand}', '\dot{m}_{SF}', 'T_{SF}', '\dot{m}_{aux}',
'\dot{q}_{boiler}', '\dot{q}_{abs}','M_{storage}', 'T_{storage}', '\dot{m}_{Storage -> boiler}', '\dot{m}_{SF->Boiler}', '\dot{m}_{SF->Storage}']
varDescription=['Hour','Direct Normal Irradiance', 'Ambient Temperature', 'Demand Mass Flow Rate', 'Temperature Demand',
'Mass flow rate from the Solar Field', 'Temperature of the Solar Field', 'Auxiliar Mass flow rate',
'Heat From The Boiler', 'Heat absorbed by the receiver','Mass in the Storage', 'Temperature of the storage', 'Mass flow rate from the Storage to the Boiler',
'Mass flow rate from the Solar Field to the Boiler', 'Mass flow rate from the Solar Field to the Storage']
df = pd.read_csv('data/CoSim.csv') #read a specific csv file
dfMILP= pd.read_csv('data/MILP.csv') #read another specific csv file with same fields
dfSM1= pd.read_csv('data/SM1.csv') #read another specific csv file with same fields
dfSM2= pd.read_csv('data/SM2.csv') #read another specific csv file with same fields
tabDataFrames=[df,dfSM1,dfSM2, dfMILP]
tabNameDataFrame=['CoSim','SM1','SM2','MILP','3 CoSim']
nameColumns=list(df.columns)
tabVar=[hm.nameAndUnit(nameColumns[i],nameColumns[i],varDescription[i],'',listLat[i]) for i in range(0,len(nameColumns))]
Daily plotting¶
def plot1VarDay(NHour, ControlModel, dayStart, var1):
titleFunc= var1.varDescription + ' in ' + var1.unitVar + ' starting on ' + hm.fromNumDayToDate(dayStart)
if(ControlModel<4):
toPlot=tabDataFrames[ControlModel][dayStart*24:dayStart*24+NHour]
toPlot['hourMod']=(toPlot['hour(h)']-dayStart*24)%NHour
toPlot=toPlot.set_index('hourMod')
toPlot.iplot(kind='scatter',y=var1.keyDF , title=titleFunc, xTitle='hour (h)',
yTitle='$'+var1.lat+'('+var1.unitVar+')$',showlegend=True)
else:
toPlot=pd.concat([tabDataFrames[i].add_suffix('_'+tabNameDataFrame[i]) for i in range(0,3)], axis=1)[dayStart*24:dayStart*24+NHour]
toPlot['hourMod']=(toPlot['hour(h)_CoSim']-dayStart*24)%NHour
toPlot=toPlot.set_index('hourMod')
toPlot[[var1.keyDF+'_'+tabNameDataFrame[i] for i in range(0,3)]].iplot(kind='scatter',
title=titleFunc, xTitle='hour (h)', yTitle='$'+var1.lat+'('+var1.unitVar+')$',showlegend=True)